<template>
  <div class="rankingList w">
    <div class="rankingListItem" v-for="item in peakMusicLists" :key="item.id">
      <div class="leftRank">
        <h3>{{ item.name }}</h3>
        <div class="rank">
          <b class="order">1.</b>
          <span class="song">{{ item.tracks[0].first }}</span>
          <span class="singer"><i>-</i>{{ item.tracks[0].second }}</span>
        </div>
        <div class="rank">
          <b class="order">2.</b>
          <span class="song">{{ item.tracks[1].first }}</span>
          <span class="singer"><i>-</i>{{ item.tracks[1].second }}</span>
        </div>
        <div class="rank">
          <b class="order">3.</b>
          <span class="song">{{ item.tracks[2].first }}</span>
          <span class="singer"><i>-</i>{{ item.tracks[2].second }}</span>
        </div>
      </div>
      <div class="rightBanner">
        <img :src="item.coverImgUrl" alt="" />
        <div class="playbackNum">
          <i class="iconfont icon-bofang"></i>
          <span class="count">{{ item.playCount | playCountFormat }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { playCountFormat } from "@/utils/index";

export default {
  name: "RankingList",
  props: {
    peakMusicLists: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  filters: {
    playCountFormat,
  },
};
</script>

<style lang="scss" scoped>
.rankingList {
  .rankingListItem {
    display: flex;
    height: 7rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    overflow: hidden;
    .leftRank {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      padding: 0.8rem 0 0.8rem 0.8rem;
      background-color: #ececec;
      color: #1a1a1a;
      h3 {
        font-weight: 400;
      }
      .rank {
        width: 90%;
        font-size: 0.8rem;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        .order {
          margin-right: 0.3rem;
        }
        .singer {
          display: inline-block;
          width: 1rem;
          color: #888;
          i {
            margin: 0 0.3rem;
          }
        }
      }
    }
    .rightBanner {
      position: relative;
      width: 7rem;
      height: 7rem;
      img {
        width: 7rem;
        height: 7rem;
      }
      .playbackNum {
        position: absolute;
        bottom: 0;
        right: 0;
        padding: 0.1rem 0.5rem;
        border-radius: 0.5rem;
        background-color: rgba(0, 0, 0, 0.5);
        font-size: 0.8rem;
        color: #fff;
        .count {
          margin-left: 0.3rem;
        }
      }
    }
  }
}
</style>